package com.windoent.yugioh.help.db;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * author : robert
 * date   : 2021/6/15 11:47
 * desc   :数据库工具
 */
public class DBHelpUtils {

    public static long insert(Context context, int id, String name, String pinyin, String code, String sort) {
        DatabaseHelper helper = new DatabaseHelper(context);
        SQLiteDatabase db = helper.getWritableDatabase();
        ContentValues cv = new ContentValues();
        cv.put(DatabaseHelper.COLUMNS_CODE, code);
        cv.put(DatabaseHelper.COLUMNS_NAME, name);
        cv.put(DatabaseHelper.COLUMNS_CITY_ID, id);
        cv.put(DatabaseHelper.COLUMNS_PINYIN, pinyin);
        cv.put(DatabaseHelper.COLUMNS_SORT, sort);
        long row = db.insert(DatabaseHelper.TB_NAME, null, cv);
        db.close();
        return row;
    }
}
